<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>住院管理</el-breadcrumb-item>
      <el-breadcrumb-item>病人管理</el-breadcrumb-item>
      <el-breadcrumb-item>病人表格</el-breadcrumb-item>
    </el-breadcrumb>
    <!--卡片视图-->
    <el-card>
      <!--搜索区域-->
      <el-row :gutter="20">
        <el-col :span="8">
          <el-input placeholder="请输入病人姓名" style="width: 100%">
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </el-col>
        <el-col :span="4">
          <el-button type="primary" @click="addDialogVisible = true"
            >入院登记</el-button
          >
        </el-col>
      </el-row>
      <!--病人列表区-->
      <el-table
        :data="PatientList"
        border
        style="margin-top: 15px; font-size: 12px"
      >
        <el-table-column type="index"></el-table-column>
        <el-table-column label="病人姓名" prop=""></el-table-column>
        <el-table-column
          label="病区"
          prop=""
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column label="性别"></el-table-column>
        <el-table-column
          label="处方"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column label="床位"></el-table-column>
        <el-table-column label="是否出院" width="170px">
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.Regis_status"
              active-text="未出院"
              inactive-text="已出院"
            >
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="住院天数" prop="type"></el-table-column>
        <el-table-column
          label="开始时间"
          prop="type"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="结束时间"
          prop="type"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column label="费用结算" prop="type"></el-table-column>
        <el-table-column label="挂号人" prop="type"></el-table-column>
        <el-table-column label="操作" width="120px">
          <template>
            <el-tooltip effect="dark" content="修改" placement="top">
              <el-button
                type="primary"
                icon="el-icon-edit"
                size="mini"
              ></el-button>
            </el-tooltip>
            <el-tooltip effect="dark" content="删除" placement="top">
              <el-button
                type="danger"
                icon="el-icon-delete"
                size="mini"
              ></el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <!--分页区域-->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryInfo.pagenum"
        :page-sizes="[1, 2, 5, 20]"
        :page-size="queryInfo.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        style="margin-top: 15px"
      >
      </el-pagination>
    </el-card>
    <!--添加挂号对话框-->
    <el-dialog
      title="添加住院病人信息"
      :visible.sync="addDialogVisible"
      width="50%"
      @close="addDialogClosed"
    >
      <!--内容主题区域-->
      <el-form
        :model="addForm"
        :rules="addFormRules"
        ref="addFormRef"
        label-width="100px"
      >
        <!--
           input框v-model后可正常输入
        -->
        <el-form-item label="病人姓名" prop="">
          <el-input></el-input>
        </el-form-item>
        <el-form-item
          label="病区"
          prop=""
          style="position: absolute; left: 50%; top: 17%; width: 100%"
        >
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="挂号人">
          <el-input></el-input>
        </el-form-item>
        <el-form-item
          label="处方"
          :label-width="formLabelWidth"
          prop=""
          style="position: absolute; left: 50%; top: 30%; width: 100%"
        >
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="床位">
          <el-input></el-input>
        </el-form-item>
        <el-form-item
          label="是否出院"
          style="position: absolute; left: 50%; top: 43%; width: 39%"
        >
          <el-select placeholder="请选择收费状态">
            <el-option label="是" value="0"></el-option>
            <el-option label="否" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="住院天数" prop="">
          <el-input></el-input>
        </el-form-item>
        <el-form-item
          label="开始时间"
          prop=""
          style="position: absolute; left: 50%; top: 55%; width: 117%"
        >
          <!-- <el-input v-model="addForm.Regis_date"></el-input> -->
          <el-col :span="20">
            <el-date-picker type="date" placeholder="选择日期"></el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item label="结束时间" prop="Regis_date" style="width: 110%">
          <el-col :span="20">
            <el-date-picker type="date" placeholder="选择日期"></el-date-picker>
          </el-col>
        </el-form-item>
        <el-form-item
          label="费用结算"
          :label-width="formLabelWidth"
          prop=""
          style="position: absolute; left: 50%; top: 68%; width: 100%"
        >
          <el-input></el-input>
        </el-form-item>
      </el-form>
      <!--主题区域-->
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">取 消</el-button>
        <el-button type="primary">登记</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      queryInfo: {
        quary: "",
        // 当前的页数
        pagenum: 1,
        // 当前每页显示多少条数据
        pagesize: 2,
      },
      total: 0,
      // 控制Dialog的显示与隐藏
      addDialogVisible: false,
      // 添加用户的表单数据
      addForm: {},
    };
  },
  methods: {
    // 监听pagesize改变的事件
    handleSizeChange(newSize) {
      console.log(newSize);
      this.queryInfo.pagesize = newSize;
      this.getRegistrationList();
    },
    // 监听 页码值改变的事件
    handleCurrentChange(newPage) {
      console.log(newPage);
      this.queryInfo.pagenum = newPage;
      this.getRegistrationList();
    },
    // 监听switch状态的变化
    payStatusChanged() {},
    // 监听添加用户对话框关闭的时间
    addDialogClosed() {
      this.$refs.addFormRef.resetFields();
    },
  },
};
</script>
<style lang="less" scoped>
.el-breadcrumb {
  margin-bottom: 15px;
  font-size: 12px;
}
.el-card {
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important;
}
.el-input {
  width: 30%;
}
.el-form-item {
  line-height: 2em;
}
</style>